<template>
  <view class="sendMsgList">
    <u-navbar
      title="问题解答"
      @rightClick="rightClick"
      :autoBack="true"
      rightText="我要反馈"
      placeholder
      safeAreaInsetTop
    >
    </u-navbar>
    <u-collapse
      @change="change"
      @close="close"
      @open="open"
      v-if="questionList.length"
    >
      <u-collapse-item
        v-for="item in questionList"
        :key="item.id"
        :title="item.content"
        :name="item.id"
      >
        <text class="u-collapse-content">{{
          item.reply_content || "问题解答中......"
        }}</text>
      </u-collapse-item>
    </u-collapse>
    <u-empty mode="message" v-else> </u-empty>
  </view>
</template>

<script>
import { feedbackLists } from "@/common/api/index.js";
export default {
  data() {
    return {
      questionList: [],
    };
  },
  async onShow() {
    await this.getQuestionList();
  },
  methods: {
    open(e) {
      // console.log('open', e)
    },
    close(e) {
      // console.log('close', e)
    },
    change(e) {
      // console.log('change', e)
    },
    async getQuestionList() {
      let res = await feedbackLists();
      console.log("getQuestionList", res);
      if (res.code == 1) {
        this.questionList = res.data.lists;
      } else {
        this.showMsg(res.msg);
      }
    },
    rightClick() {
      uni.navigateTo({
        url: `/pages/mine/sendMsg/sendMsg`,
      });
    },
  },
};
</script>

<style scoped>
.topNav {
  background-color: #fff;
  border-radius: 50rpx;
}

.feedback-container {
  padding: 20px;
}

.header {
  text-align: center;
  margin-bottom: 20px;
}

.title {
  font-size: 18px;
  font-weight: bold;
}

.form-item {
  margin-bottom: 20px;
}

.label {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
  display: block;
}

.input-textarea {
  width: 100%;
  height: 150px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.word-count {
  font-size: 12px;
  color: #999;
  text-align: right;
  display: block;
  margin-top: 4px;
}

.submit-btn {
  background-color: #007aff;
  padding: 12px;
  border-radius: 4px;
  text-align: center;
  margin-top: 20px;
}

.btn-text {
  color: #fff;
  font-size: 16px;
}

.message {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: #f00;
}
</style>
